<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >

<html xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<f:view contentType="text/html">
	<h:head>
		<h:outputStylesheet library="css" name="common-style.css" />
		<h:outputScript library="primefaces" name="jquery/jquery.js" />	
		<h:outputScript library="javascript" name="common-script.js" />
		<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> 		
	</h:head>
	
	<h:body>
		<p:growl id="grow-messages" autoUpdate="true" showDetail="true" />
		<p:ajaxStatus onstart="statusDialog.show();" onsuccess="statusDialog.hide();"/>		
		<div id="container">			
			<div id="header" class="ui-menu">
				<h:form>
					<div id="logo">
						<p:graphicImage value="#{resource['images:util/manager-logo.png']}"/>
					</div>
					<div id="search-tag">
						<p:selectOneMenu>  				            
				            <f:selectItem itemLabel="Imóvel" itemValue="1" />  
				            <f:selectItem itemLabel="Automóvel" itemValue="2" />  
				            <f:selectItem itemLabel="Outros" itemValue="3" />  
				        </p:selectOneMenu>  
					</div>
					<div id="busca">
						<p:inputText id="search-term" size="40"/><p:spacer width="5px"/><p:button icon="search-icon" title="Buscar"/>
						<p:spacer width="5px"/><p:commandButton icon="advanced-search-icon" title="Busca Avançada" onclick="dialogSearch.show();"/>
						<p:watermark for="search-term" value="Digite o termo para pesquisa"></p:watermark>
					</div>
					<div id="gear">
						<p:commandButton icon="mail-icon" title="Mensagens" onclick="dialogMail.show()"/>						
					</div>
					<div id="manager">
						<p:menubar styleClass="menu-manager" style="padding: 0px;width: 110px;" >
							<p:submenu label="Administração">
								<p:menuitem value="Alterar Senha" onclick="dialogChangePass.show()" />
								<p:menuitem value="Sair" action="#{usuarioController.logout}" ajax="false" />
							</p:submenu>
						</p:menubar>
					</div>	
					
				</h:form>			
			</div>
			<div id="contents">
				<p:fieldset styleClass="manager-fieldset-content">	
					<div id="menu-content">
						<ui:insert name="menu">
							<ui:include src="menu.xhtml" />
						</ui:insert>							
					</div>
				
					<div id="content">
						<ui:insert name="body"/>
					</div>
				</p:fieldset>
			</div>
			<div id="footer"></div>
		</div>	 
		
		<!-- Dialogs - busca avançada -->		
		<p:dialog header="Busca Avançada" widgetVar="dialogSearch" resizable="false" height="400" width="640" modal="true">
			
		</p:dialog>
		
		<!-- Dialogs - mensagens -->		
		<p:dialog header="Mensagens" widgetVar="dialogMail" resizable="false" height="400" width="640" modal="true">
			
		</p:dialog>
		
		<!-- Dialogs - alterar senha -->
		<p:dialog header="Alterar Senha" widgetVar="dialogChangePass" resizable="false" height="230" width="420" modal="true">
			<h:form>
				<p:panel id="panel-change-pass" style="height: 215px">
					<div style="height: 158px;width: 100%">
						<table width="100%" cellpadding="0" cellspacing="0">
							<tr>
								<td style="width: 60px;height: 30px"><h:outputLabel value="Nome:" /></td>
								<td style="width: 175px;height: 30px"><h:outputText value="#{usuarioController.loggedUser.nome}" /></td>
							</tr>
							<tr>
								<td style="width: 60px;height: 30px"><h:outputLabel value="Email:" /></td>
								<td style="width: 175px;height: 30px"><h:outputText value="#{usuarioController.loggedUser.email}" /></td>
							</tr>
							<tr>
								<td style="width: 60px;height: 30px"><h:outputLabel value="Login:" /></td>
								<td style="width: 175px;height: 30px"><h:outputText value="#{usuarioController.loggedUser.login}" /></td>
							</tr>
							<tr>
								<td style="width: 60px;height: 30px"><h:outputLabel value="Senha:" /></td>
								<td style="width: 175pxheight: 30px"><p:password id="txt-nova-senha" size="30" minLength="6" maxlength="12" feedback="false" value="#{usuarioController.novaSenha}"/></td>
							</tr>
						</table>
					</div>
					<f:facet name="footer">
						<div style="float: right;">
							<p:commandButton icon="ok-icon" title="Alterar senha" actionListener="#{usuarioController.passwd}" oncomplete="dialogChangePass.hide();"/>
						</div>
						
					</f:facet>
				</p:panel>
			</h:form>
		</p:dialog>
		
		<!-- Dialog - status ajax -->
		<p:dialog modal="true" widgetVar="statusDialog" header="Processando..."   
		        draggable="false" closable="false" resizable="false">  
		    <p:graphicImage value="#{resource['images:util/ajax-loader.gif']}" />  
		</p:dialog>  
		
		<!-- Dialogs - lanacamentos -->		
		<p:dialog header="Lançamento" widgetVar="dialogLancamento" resizable="false" height="450" width="640" modal="true">			
			<p:outputPanel id="lancamento-panel">
				<h:form>
					<p:tabView id="tab-lancamento" style="height:440px;" dynamic="true">  
						<p:tab id="sumario-lancamento" title="Sumário">
							<div class="label-text-field"><h:outputText value="Ramo:" /></div>
							<div class="value-text-field"><b><h:outputText value="#{dashboardController.anuncio.ramo.nome}" /></b></div>	
							<p:spacer height="5px" width="100%" />
							<div class="label-text-field"><h:outputText value="Código:" /></div>
							<div class="value-text-field"><h:outputText value="#{dashboardController.anuncio.id}" /></div>			
							<p:spacer height="5px" width="100%" />
							<div class="label-text-field"><h:outputText value="Título:" /></div>
							<div class="value-text-field"><h:outputText value="#{dashboardController.anuncio.titulo}" /></div>
							<p:spacer height="5px" width="100%" />
							<div class="label-text-field"><h:outputText value="Descrição:" /></div>
							<div class="value-text-multiple"><h:outputText value="#{dashboardController.anuncio.descricao}" /></div>	
							<p:spacer height="5px" width="100%" />
							<div class="label-text-field"><h:outputText value="Logradouro:" /></div>
							<div class="value-text-multiple">
								<h:outputText value="#{dashboardController.anuncio.contato.endereco.rua}" />,
								<h:outputText value="#{dashboardController.anuncio.contato.endereco.numero}" />
							</div>	
							<p:spacer height="5px" width="100%" />
							<div class="label-text-field"><h:outputText value="Bairro:" /></div>
							<div class="value-text-multiple"><h:outputText value="#{dashboardController.anuncio.contato.endereco.bairro}" /></div>
							<p:spacer height="5px" width="100%" />
							<div class="label-text-field"><h:outputText value="Município:" /></div>
							<div class="value-text-multiple"><h:outputText value="#{dashboardController.anuncio.contato.endereco.municipio.nome}" /></div>
							<p:spacer height="5px" width="100%" />
							<div class="label-text-field"><h:outputText value="Estado:" /></div>
							<div class="value-text-multiple"><h:outputText value="#{dashboardController.anuncio.contato.endereco.municipio.estado.sigla}" /></div>
							<p:spacer height="3px" width="100%" />
							<p:separator id="customSeparator" style="width:100%;height:1px" />  
							<p:spacer height="3px" width="100%" />
							<div class="label-text-field"><h:outputText value="Contato:" /></div>
							<div class="value-text-field"><h:outputText value="#{dashboardController.anuncio.contato.pessoa.nome}" /></div>						
							<p:spacer height="5px" width="100%" />
							<div class="label-text-field"><h:outputText value="Telefone fixo:" /></div>
							<div class="value-text-field"><h:outputText value="#{dashboardController.anuncio.contato.telefoneFixo}" /></div>
							<p:spacer height="5px" width="100%" />
							<div class="label-text-field"><h:outputText value="Telefone celular:" /></div>
							<div class="value-text-field"><h:outputText value="#{dashboardController.anuncio.contato.telefoneCelular}" /></div>
							<p:spacer height="5px" width="100%" />
							<div class="label-text-field"><h:outputText value="Email:" /></div>
							<div class="value-text-field"><h:outputText value="#{dashboardController.anuncio.contato.email}" /></div>
						</p:tab>
					
						<p:tab id="album-lancamento" title="Album">	
							<div style="overflow-y: hidden;height: 390px;overflow-x: hidden;text-align: center;">								
								<p:commandButton type="button" onclick="switcherLancamento.previous();" icon="ui-icon-circle-triangle-w" />  
								<p:spacer height="10px;" width="10px"/>
								<p:commandButton type="button" onclick="switcherLancamento.next();" icon="ui-icon-circle-triangle-e"/>  
								
								<p:separator style="width:100%;height:1px;" />
								
								<p:imageSwitch effect="wipe" widgetVar="switcherLancamento" slideshowAuto="false" style="display: block;margin-left: auto;margin-right: auto;">  
								    <ui:repeat value="#{dashboardController.anuncio.album}" var="image">  
								        <p:graphicImage value="#{image.originalImage}"/>  
								    </ui:repeat>  
								</p:imageSwitch> 						
							</div>																			
						</p:tab>
						
						<p:tab id="mapa-lancamento" title="Mapa">						
							<p:gmap center="#{dashboardController.anuncio.localizacao}" zoom="15" model="#{dashboardController.anuncio.mapModel}" type="terrain" 
								style="height:340px;width:585px;" mapTypeControl="false" navigationControl="true" />	
							
							<p:separator style="width:100%;height:1px;" />
							
							<h:outputText value="#{dashboardController.anuncio.contato.endereco.rua}" />,<h:outputText value="#{dashboardController.anuncio.contato.endereco.numero}" />
							<p:spacer width="100%" height="10px" />
							<h:outputText value="#{dashboardController.anuncio.contato.endereco.bairro}" />
							<p:spacer width="5px;" />-<p:spacer width="5px;" />
							<h:outputText value="#{dashboardController.anuncio.contato.endereco.municipio.nome}" />/<h:outputText value="#{dashboardController.anuncio.contato.endereco.municipio.estado.sigla}" />																		
						</p:tab>
					</p:tabView>
				</h:form>							
			</p:outputPanel>
		</p:dialog>
		
		<!-- Dialogs - destaques -->		
		<p:dialog header="Destaque" widgetVar="dialogDestaque" resizable="false" height="450" width="640" modal="true">
			<p:outputPanel id="destaque-panel">
				<h:form>
					<p:tabView id="tab-destaque" style="height:440px;" dynamic="true">  
						<p:tab id="sumario-destaque" title="Sumário">
							<div class="label-text-field"><h:outputText value="Ramo:" /></div>
							<div class="value-text-field"><b><h:outputText value="#{dashboardController.anuncio.ramo.nome}" /></b></div>
							<p:spacer height="5px" width="100%" />
							<div class="label-text-field"><h:outputText value="Código:" /></div>
							<div class="value-text-field"><h:outputText value="#{dashboardController.anuncio.id}" /></div>						
							<p:spacer height="5px" width="100%" />
							<div class="label-text-field"><h:outputText value="Título:" /></div>
							<div class="value-text-field"><h:outputText value="#{dashboardController.anuncio.titulo}" /></div>
							<p:spacer height="5px" width="100%" />
							<div class="label-text-field"><h:outputText value="Descrição:" /></div>
							<div class="value-text-multiple"><h:outputText value="#{dashboardController.anuncio.descricao}" /></div>	
							<p:spacer height="5px" width="100%" />
							<div class="label-text-field"><h:outputText value="Logradouro:" /></div>
							<div class="value-text-multiple">
								<h:outputText value="#{dashboardController.anuncio.contato.endereco.rua}" />,
								<h:outputText value="#{dashboardController.anuncio.contato.endereco.numero}" />
							</div>	
							<p:spacer height="5px" width="100%" />
							<div class="label-text-field"><h:outputText value="Bairro:" /></div>
							<div class="value-text-multiple"><h:outputText value="#{dashboardController.anuncio.contato.endereco.bairro}" /></div>
							<p:spacer height="5px" width="100%" />
							<div class="label-text-field"><h:outputText value="Município:" /></div>
							<div class="value-text-multiple"><h:outputText value="#{dashboardController.anuncio.contato.endereco.municipio.nome}" /></div>
							<p:spacer height="5px" width="100%" />
							<div class="label-text-field"><h:outputText value="Estado:" /></div>
							<div class="value-text-multiple"><h:outputText value="#{dashboardController.anuncio.contato.endereco.municipio.estado.sigla}" /></div>
							<p:spacer height="3px" width="100%" />
							<p:separator id="customSeparator" style="width:100%;height:1px" />  
							<p:spacer height="3px" width="100%" />
							<div class="label-text-field"><h:outputText value="Contato:" /></div>
							<div class="value-text-field"><h:outputText value="#{dashboardController.anuncio.contato.pessoa.nome}" /></div>						
							<p:spacer height="5px" width="100%" />
							<div class="label-text-field"><h:outputText value="Telefone fixo:" /></div>
							<div class="value-text-field"><h:outputText value="#{dashboardController.anuncio.contato.telefoneFixo}" /></div>
							<p:spacer height="5px" width="100%" />
							<div class="label-text-field"><h:outputText value="Telefone celular:" /></div>
							<div class="value-text-field"><h:outputText value="#{dashboardController.anuncio.contato.telefoneCelular}" /></div>
							<p:spacer height="5px" width="100%" />
							<div class="label-text-field"><h:outputText value="Email:" /></div>
							<div class="value-text-field"><h:outputText value="#{dashboardController.anuncio.contato.email}" /></div>
						</p:tab>
					
						<p:tab id="album-destaque" title="Album">
							<div style="overflow-y: hidden;height: 390px;overflow-x: hidden;text-align: center;">								
								<p:commandButton type="button" onclick="switcherDestaque.previous();" icon="ui-icon-circle-triangle-w" />  
								<p:spacer height="10px;" width="10px"/>
								<p:commandButton type="button" onclick="switcherDestaque.next();" icon="ui-icon-circle-triangle-e"/>  
								
								<p:separator style="width:100%;height:1px;" />
								
								<p:imageSwitch effect="wipe" widgetVar="switcherDestaque" slideshowAuto="false" style="display: block;margin-left: auto;margin-right: auto;">  
								    <ui:repeat value="#{dashboardController.anuncio.album}" var="image">  
								        <p:graphicImage value="#{image.originalImage}"/>  
								    </ui:repeat>  
								</p:imageSwitch> 						
							</div>		
						</p:tab>
						
						<p:tab id="mapa-destaque" title="Mapa">
							<p:gmap center="#{dashboardController.anuncio.localizacao}" zoom="15" model="#{dashboardController.anuncio.mapModel}" type="terrain" 
								style="height:340px;width:585px;" mapTypeControl="false" navigationControl="true" />
								
							<p:separator style="width:100%;height:1px;" />
								
							<h:outputText value="#{dashboardController.anuncio.contato.endereco.rua}" />,<h:outputText value="#{dashboardController.anuncio.contato.endereco.numero}" />
							<p:spacer width="100%" height="10px" />
							<h:outputText value="#{dashboardController.anuncio.contato.endereco.bairro}" />
							<p:spacer width="5px;" />-<p:spacer width="5px;" />
							<h:outputText value="#{dashboardController.anuncio.contato.endereco.municipio.nome}" />/<h:outputText value="#{dashboardController.anuncio.contato.endereco.municipio.estado.sigla}" />	
						</p:tab>
					</p:tabView>
				</h:form>	
			</p:outputPanel>
		</p:dialog>
		
	</h:body>	
</f:view>

</html>